package cn.tedu.bonfire.front.content.dao.persist.repository.impl;


import cn.tedu.bonfire.common.pojo.entity.Inform;
import cn.tedu.bonfire.front.content.dao.persist.mapper.InformMapper;
import cn.tedu.bonfire.front.content.dao.persist.repository.IInformRepository;
import cn.tedu.bonfire.front.content.pojo.vo.InformVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class InformRepositoryImpl implements IInformRepository {

    @Autowired
    InformMapper informMapper;

    /**
     * 插入通知
     */
    @Override
    public void insertInform(Inform inform) {
        informMapper.insert(inform);
    }

    @Override
    public int countNewInforms(Long userId,Integer type) {
        return informMapper.countNewInforms(userId,type);
    }

    @Override
    public int updateInformNotNew(Inform inform) {
        return informMapper.updateById(inform);
    }

    /**
     *获取新通知
     */
    @Override
    public List<InformVO> listNewInformsByType(Long userId,Integer type) {
        return informMapper.listNewInformsByType(userId,type);
    }

    /**
     *获取所有通知
     */
    @Override
    public List<InformVO> listAllInforms(Long userId,Integer type) {
        return informMapper.listAllInforms(userId,type);
    }
}
